package com.yyq.educms.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yyq.educms.entity.CrmBanner;
import com.yyq.educms.mapper.CrmBannerMapper;
import com.yyq.educms.service.CrmBannerService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 首页banner表 服务实现类
 * </p>
 *
 * @author yyq
 * @since 2021-04-23
 */
@Service
public class CrmBannerServiceImpl extends ServiceImpl<CrmBannerMapper, CrmBanner> implements CrmBannerService {

    @Override
    public List<CrmBanner> selcecTwoBanner() {
        //根据ｉｄ降序排列
        //后加sql语句限制两条记录
        QueryWrapper<CrmBanner> wrapper=new QueryWrapper<>();
         wrapper.orderByDesc("sort");
        //查询ｓｏｒｔ为１
        wrapper.ne("sort",0);
//        wrapper.eq("sort",1);
//        wrapper.last("limit 2");
        List<CrmBanner> list = baseMapper.selectList(wrapper);
        return list;
    }
}
